package
{
import com.vcommon.core.logging.LogLevel;
import com.vcommon.core.logging.Tracer;
import com.vcommon.core.logging.publishers.Output;
import com.vcommon.core.logging.publishers.SaveLogPublisher;
import com.vcommon.core.logging.publishers.TracePublisher;

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.system.Security;

import starling.core.Starling;

/**
 * author yangwz
 */		
[SWF(frameRate="30", width="760", height="600", backgroundColor="#000000")]
public class StarlingExample extends Sprite
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	/**
	 * Constructs a new <code>StarlingExample</code> instance.
	 * 
	 */
	public function StarlingExample()
	{
		if (stage) initDisplay();
		else addEventListener(Event.ADDED_TO_STAGE, initDisplay);
	}
	//==========================================================================
	//  Variables
	//==========================================================================
	private var myStarling:Starling;
	//==========================================================================
	//  Methods
	//==========================================================================
	private function initDisplay(event:Event = null):void
	{
		removeEventListener(Event.ADDED_TO_STAGE, initDisplay);
		if (true)
		{
			//init logging
			Output.MAX_LINE = 10000;
			var output:Output = new Output(200, true);
			stage.addChild(output);
			stage.removeChild(output);
			Tracer.logger.addPublisher(new TracePublisher());
			Tracer.logger.addPublisher(new SaveLogPublisher());
			Tracer.logger.level = LogLevel.DEBUG;
			Tracer.info("sandboxType:" + Security.sandboxType);
		} 
		stage.align = StageAlign.TOP_LEFT;
		stage.scaleMode = StageScaleMode.NO_SCALE;
		
		myStarling = new Starling(Game, stage);
		myStarling.antiAliasing = 1;
		myStarling.start();
	}
}
}